package hbase;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

/**
 * @Description 加载HBase配置文件
 * @Author zhangxin
 * @Date 2017/4/25 19:19
 **/
public class ReadHBaseConf {
    private static Properties property = null;

    public void readProperty(){
        try {
            FileInputStream file = new FileInputStream(System.getProperty("user.dir")+"/hbaseconf.properties");
            property = new Properties();
            try {
                property.load(file);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                System.out.println("未找到配置文件");
            }
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            System.out.println("配置文件错误");
        }
    }

    /**
     * @Description 获取HBase配置文件
     * @Author zhangxin
     * @Date 2017/4/25 19:19
     **/
    public String getProperty(String key){
        readProperty();
        return property.getProperty(key);
    }


    public static void main(String args[]){
        HBaseUtil.getHBASECONFIG().getConnection();
        System.out.println("OK");
    }

}
